package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.AwardsRuleMapper;
import com.ruoyi.system.domain.AwardsRule;
import com.ruoyi.system.service.IAwardsRuleService;

/**
 * 奖项规则Service业务层处理
 *
 * @author xrx
 * @date 2024-06-12
 */
@Service
public class AwardsRuleServiceImpl implements IAwardsRuleService
{
    @Autowired
    private AwardsRuleMapper awardsRuleMapper;

    /**
     * 查询奖项规则
     *
     * @param id 奖项规则主键
     * @return 奖项规则
     */
    @Override
    public AwardsRule selectAwardsRuleById(Long id)
    {
        return awardsRuleMapper.selectAwardsRuleById(id);
    }

    /**
     * 查询奖项规则列表
     *
     * @param awardsRule 奖项规则
     * @return 奖项规则
     */
    @Override
    public List<AwardsRule> selectAwardsRuleList(AwardsRule awardsRule)
    {
        return awardsRuleMapper.selectAwardsRuleList(awardsRule);
    }

    /**
     * 新增奖项规则
     *
     * @param awardsRule 奖项规则
     * @return 结果
     */
    @Override
    public int insertAwardsRule(AwardsRule awardsRule)
    {
        awardsRule.setCreateTime(DateUtils.getNowDate());
        return awardsRuleMapper.insertAwardsRule(awardsRule);
    }

    /**
     * 修改奖项规则
     *
     * @param awardsRule 奖项规则
     * @return 结果
     */
    @Override
    public int updateAwardsRule(AwardsRule awardsRule)
    {
        return awardsRuleMapper.updateAwardsRule(awardsRule);
    }

    /**
     * 批量删除奖项规则
     *
     * @param ids 需要删除的奖项规则主键
     * @return 结果
     */
    @Override
    public int deleteAwardsRuleByIds(Long[] ids)
    {
        return awardsRuleMapper.deleteAwardsRuleByIds(ids);
    }

    /**
     * 删除奖项规则信息
     *
     * @param id 奖项规则主键
     * @return 结果
     */
    @Override
    public int deleteAwardsRuleById(Long id)
    {
        return awardsRuleMapper.deleteAwardsRuleById(id);
    }

    @Override
    public AwardsRule selectAwardsRuleByAwardsId(Long awardsId) {

        return awardsRuleMapper.selectAwardsRuleByAwardsId(awardsId);
    }
}
